<html>
<title>Release Process</title>
<body>
<h2>Release Process</h2>

<h3>First time set up</h3>
<ul>
  <li>Make sure you have at least a Committer role</li>
  <li>Make sure you have permission to post to the <a
    href="http://google-api-java-client.blogspot.com/">Announcement Blog</a>.</li>
  <li>Download <a href="http://sourceforge.net/projects/javadiff/">JDiff</a>.</li>
  <li>Set up for pushing to the central Maven repository
    <ul>
      <li>Sign up for a Sonatype JIRA account at <a
        href="https://issues.sonatype.org/">https://issues.sonatype.org</a>. Click
      <i>Sign Up</i> in the Login box, fill out the simple form, and click <i>Sign
      Up</i>.</li>
      <li>Request publishing rights to the maven project:</li>
        <ul>
          <li>Go to <a href="https://issues.sonatype.org/browse/OSSRH">
            https://issues.sonatype.org/browse/OSSRH</a></li>
          <li>Click "Create Issue" in the top-right corner.</li>
          <li>Fill our the ticket form as follows, or use <a href="https://issues.sonatype.org/browse/OSSRH-4565">this</a> previous issue as a
            template:
            <ul>
              <li><b>Type:</b> New Project</li>
              <li><b>Summary:</b> Publish rights for already existing project</li>
              <li><b>Description: </b>This project already exists, I just need to have publish rights to deploy a new release. Thank you.</li>
              <li><b>Group Id:</b> com.google.api.client</li>
              <li><b>Project URL:</b> http://code.google.com/p/google-api-java-client/</li>
              <li><b>SCM url:</b> https://google-api-java-client.googlecode.com/hg/</li>
              <li><b>Username:</b> <i>YourUsername</i></li>
            </ul>
          </li>
        </ul>
      </li>
    </ul>
    <li>Install a GPG client from <a href="http://www.gnupg.org/">http://www.gnupg.org/</a>,
    and then create a GPG key using <a
      href="http://www.sonatype.com/people/2010/01/how-to-generate-pgp-signatures-with-maven/">these
    instructions</a>, making sure to specify a passphrase to be used every time you
    release. Make sure to run the instructions under "Distribute Your Public
    Key".</li>
    <li>Add these lines to your <code>~/.hgrc</code>: <pre><code>
[ui]
username = Your Name <i>&lt;yourname@domain.com&gt;</i>

[auth]
google-api-java-client.prefix = https://google-api-java-client.googlecode.com/hg/
google-api-java-client.username = <i>[username from <a
      href="https://code.google.com/hosting/settings">https://code.google.com/hosting/settings</a>]</i>
google-api-java-client.password = <i>[password from <a
      href="https://code.google.com/hosting/settings">https://code.google.com/hosting/settings</a>]</i>
javadoc-google-api-java-client.prefix = https://javadoc.google-api-java-client.googlecode.com/hg/
javadoc-google-api-java-client.username = <i>[username from <a
      href="https://code.google.com/hosting/settings">https://code.google.com/hosting/settings</a>]</i>
javadoc-google-api-java-client.password = <i>[password from <a
      href="https://code.google.com/hosting/settings">https://code.google.com/hosting/settings</a>]</i>
wiki-google-api-java-client.prefix = https://wiki.google-api-java-client.googlecode.com/hg/
wiki-google-api-java-client.username = <i>[username from <a
      href="https://code.google.com/hosting/settings">https://code.google.com/hosting/settings</a>]</i>
wiki-google-api-java-client.password = <i>[password from <a
      href="https://code.google.com/hosting/settings">https://code.google.com/hosting/settings</a>]</i></code></pre></li>
    <li>Add these lines to your <code>~/.m2/settings.xml</code> (create
    this file if it does not already exist): <pre><code>&lt;settings&gt;
  &lt;servers&gt;
    &lt;server&gt;
      &lt;id&gt;google-snapshots&lt;/id&gt;
      &lt;username&gt;<i>[username for <a
      href="https://issues.sonatype.org/">https://issues.sonatype.org</a>]</i>&lt;/username&gt;
      &lt;password&gt;<i>[password for <a
      href="https://issues.sonatype.org/">https://issues.sonatype.org</a>]</i>&lt;/password&gt;
    &lt;/server&gt;
    &lt;server&gt;
      &lt;id&gt;google-releases&lt;/id&gt;
      &lt;username&gt;<i>[username for <a
      href="https://issues.sonatype.org/">https://issues.sonatype.org</a>]</i>&lt;/username&gt;
      &lt;password&gt;<i>[password for <a
      href="https://issues.sonatype.org/">https://issues.sonatype.org</a>]</i>&lt;/password&gt;
    &lt;/server&gt;
    &lt;server&gt;
      &lt;id&gt;sonatype-nexus-snapshots&lt;/id&gt;
      &lt;username&gt;<i>[username for <a
      href="https://issues.sonatype.org/">https://issues.sonatype.org</a>]</i>&lt;/username&gt;
      &lt;password&gt;<i>[password for <a
      href="https://issues.sonatype.org/">https://issues.sonatype.org</a>]</i>&lt;/password&gt;
    &lt;/server&gt;
    &lt;server&gt;
      &lt;id&gt;sonatype-nexus-staging&lt;/id&gt;
      &lt;username&gt;<i>[username for <a
      href="https://issues.sonatype.org/">https://issues.sonatype.org</a>]</i>&lt;/username&gt;
      &lt;password&gt;<i>[password for <a
      href="https://issues.sonatype.org/">https://issues.sonatype.org</a>]</i>&lt;/password&gt;
    &lt;/server&gt;
  &lt;/servers&gt;
&lt;/settings&gt;</code></pre></li>
  </ul>
  </li>
</ul>

<h3>Fork version 1.14.0-beta</h3>
This is done in preparation for release of the 1.14 branch a week before the
official launch. We create a named Mercurial branch for 1.14. Development in the
default Mercurial branch may then progress for the next minor version.
<ul>
  <li>Create the Mercurial named branch: <pre>
hg branch 1.14
hg commit -m "create 1.14 branch in preparation for release"
hg push --new-branch
hg update default
</pre></li>
  <li>Update existing files by replacing <code>1.14.0-beta</code> with the
  next minor version. This can be done by running this set of sed commands:
<pre>
VER_NEXT=1.15; VER_CUR=1.14; VER_PREV=1.13; VER_SUFFIX='\.0-beta'
function esc() { echo $@ | sed "s/\./\\\./g"; }
ESC_VER_NEXT=`esc ${VER_NEXT}`; ESC_VER_CUR=`esc ${VER_CUR}`; ESC_VER_PREV=`esc ${VER_PREV}`
sed -i "s@${ESC_VER_CUR}${VER_SUFFIX}@${ESC_VER_NEXT}${VER_SUFFIX}@g" pom.xml
sed -i "s@${ESC_VER_CUR}${VER_SUFFIX}@${ESC_VER_NEXT}${VER_SUFFIX}@g" */pom.xml
for filename in google-api-client-assembly/android-properties/*.properties; do newname=`echo $filename | sed -e "s@${ESC_VER_CUR}${VER_SUFFIX}@${ESC_VER_NEXT}${VER_SUFFIX}@g"`; hg mv $filename $newname; done
sed -i -e "s@${ESC_VER_CUR}${VER_SUFFIX}@${ESC_VER_NEXT}${VER_SUFFIX}@g" -e "s@${ESC_VER_PREV}${VER_SUFFIX}@${ESC_VER_CUR}${VER_SUFFIX}@g" jdiff.xml
sed -i "s@${ESC_VER_CUR}${VER_SUFFIX}@${ESC_VER_NEXT}${VER_SUFFIX}@g" google-api-client/src/main/java/com/google/api/client/googleapis/GoogleUtils.java
sed -i -e "s@${ESC_VER_CUR}@${ESC_VER_NEXT}@g" -e "s@${ESC_VER_PREV}@${ESC_VER_CUR}@g" release.html
echo -n && read -e -p "Version which comes after ${VER_NEXT}: " NV && sed -i -e "s@VER_NEXT=${ESC_VER_NEXT}@VER_NEXT=${NV}@g" release.html
</pre></li>
  <li>Commit and push: <pre>
Submit the changes for review as usual, using upload.py
hg commit -m "Start next minor version"
hg push
</pre></li>
</ul>

<h3>Release version 1.14.0-beta</h3>
This process is followed for the official launch. We are releasing the code from
the 1.14 Mercurial branch.
<ul>
  <li>Checkout the source, update dependencies.html, update android-properties, and push to central Maven repository (based on
  instructions from <a href="https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide">Sonatype OSS Maven Repository Usage Guide</a>):<pre>
cd /tmp
rm -rf google-api-java-client
mkdir google-api-java-client
cd google-api-java-client
hg clone -b 1.14 https://google-api-java-client.googlecode.com/hg/ 1.14
cd 1.14

Consider changing value of $project.http.version and $project.oauth.version variables in pom.xml

mvn project-info-reports:dependencies
cp google-api-client/target/site/dependencies.html google-api-client-assembly/dependencies/dependencies.html
cp google-api-client-android/target/site/dependencies.html google-api-client-assembly/dependencies/android-dependencies.html
cp google-api-client-appengine/target/site/dependencies.html google-api-client-assembly/dependencies/appengine-dependencies.html
cp google-api-client-java6/target/site/dependencies.html google-api-client-assembly/dependencies/java6-dependencies.html
cp google-api-client-servlet/target/site/dependencies.html google-api-client-assembly/dependencies/servlet-dependencies.html

sed s/-SNAPSHOT//g &lt;google-api-client/src/main/java/com/google/api/client/googleapis/GoogleUtils.java &gt;/tmp/GoogleUtils.java
cp /tmp/GoogleUtils.java google-api-client/src/main/java/com/google/api/client/googleapis/GoogleUtils.java

for filename in google-api-client-assembly/android-properties/*.properties; do newname=`echo $filename | sed -e 's/-SNAPSHOT//g'`; mv $filename $newname; done

Submit the changes for review as usual, using upload.py

hg commit -m "prepare 1.14.0-beta for release"
hg push

mvn clean deploy
mvn release:clean
mvn release:prepare -DautoVersionSubmodules=true -Dtag=1.14.0-beta --batch-mode
mvn release:perform -Darguments=-Dgpg.passphrase=<i>[YOUR GPG PASSPHRASE]</i>
</pre></li>
  <li>Release on oss.sonatype.org
  <ul>
    <li>Log in to <a href="https://oss.sonatype.org">https://oss.sonatype.org</a></li>
    <li>Click on "Staging Repositories" and look for the "com.google"
    Repository with your username</li>
    <li>check box next to uploaded release; click Close; click Close</li>
    <li>check box next to uploaded release; click Release; click Release</li>
  </ul>
    Central Maven repository is synced hourly. Once uploaded onto
    repo2.maven.org, it will be found at: <a
      href="http://repo2.maven.org/maven2/com/google/api-client/google-api-client/1.14.0-beta/">repo2.maven.org</a>
  </li>
  <li>Start development of next bug fix version, by replacing <code>1.14.0-beta</code> with the next bug fix version:<pre>
NEXT_VERSION=<i>(next bug fix version 1.14.X-beta)</i>
for filename in google-api-client-assembly/android-properties/*.properties; do newname=`echo $filename | sed -e "s/1.14.0-beta/$NEXT_VERSION/g"`; mv $filename $newname; done
sed s/1.14.0-beta/$NEXT_VERSION/g &lt;jdiff.xml &gt;/tmp/jdiff.xml
sed s/1.14.0-beta/$NEXT_VERSION/g &lt;release.html &gt;/tmp/release.html
sed s/1.14.0-beta/$NEXT_VERSION-SNAPSHOT/g &lt;google-api-client/src/main/java/com/google/api/client/googleapis/GoogleUtils.java &gt;/tmp/GoogleUtils.java
mv /tmp/jdiff.xml /tmp/release.html .
mv /tmp/GoogleUtils.java google-api-client/src/main/java/com/google/api/client/googleapis/
Consider changing value of $project.http.version and $project.oauth.version variables in pom.xml
hg commit -m "start $NEXT_VERSION"
hg push
</pre></li>
  <li>Prepare the released library zip file and javadoc
  <ul>
    <li>Overview: JDiff is a tool for showing the difference between the
    JavaDoc of one version of the library vs. the JavaDoc of an old version of
    the library. Hence, we will check out the last minor version of the library
    into a temporary directory and compare against the JavaDoc of the just
    released version of the library, and then hg commit that diff into the
    javadoc Hg repository.</li>
    </ul><pre>
cd /tmp/google-api-java-client
hg clone https://code.google.com/p/google-api-java-client.javadoc/ javadoc
hg clone https://code.google.com/p/google-api-java-client.wiki/ wiki
hg clone -r 1.13.0-beta https://google-api-java-client.googlecode.com/hg/ 1.13.0-beta
hg clone -r 1.14.0-beta https://google-api-java-client.googlecode.com/hg/ 1.14.0-beta

cd 1.14.0-beta
mvn javadoc:jar install site
cp -R target/site/apidocs ../javadoc/1.14.0-beta
<i>change these constants from jdiff.xml for your environment: JDIFF_HOME,
MAVEN_REPOSITORY_HOME</i>
ant -f jdiff.xml

cd ../javadoc
hg add
PREV_VERSION=<i>(previous bug fix version 1.13.X-beta)</i>
sed s/$PREV_VERSION/1.14.0-beta/g <index.html >/tmp/index.html && mv /tmp/index.html index.html
hg commit -m "1.14.0-beta"
hg push

cd ../wiki
for s in *; do sed s/$PREV_VERSION/1.14.0-beta/g <$s >/tmp/$s && mv /tmp/$s .; done
hg revert --no-backup ReleaseNotes.wiki
<i>edit ReleaseNotes.wiki to add release notes for 1.14.0-beta</i>
hg commit -m "1.14.0-beta"
hg push
</pre></li>
  <li><b>WAIT!</b> Don't do the following instructions until after the
  library has been uploaded to repo2.maven.org at: <a
    href="http://repo2.maven.org/maven2/com/google/api-client/google-api-client/1.14.0-beta/">repo2.maven.org</a></li>
  <li>Update to new version on <a
    href="http://code.google.com/p/google-api-java-client">http://code.google.com/p/google-api-java-client</a>
  <ul>
    <li>Upload to <a
      href="http://code.google.com/p/google-api-java-client/downloads/entry">http://code.google.com/p/google-api-java-client/downloads/entry</a>
    <ul>
      <li>Summary: Google API Client Library for Java, version 1.14.0-beta</li>
      <li>File:
      <code>/tmp/google-api-java-client/1.14.0-beta/google-api-client-assembly/target/google-api-client-1.14.0-beta-java.zip</code></li>
      <li>Labels: <code>Type-Archive</code>, <code>OpSys-All</code>, and <code>Featured</code></li>
      <li>click Submit file</li>
    </ul>
    </li>
    <li>If it is a bug fix release, deprecate the library from any previous
    versions by removing any <code>Featured</code> label and adding the <code>Deprecated</code>
    label.</li>
    <li>Update the following pages changing any reference from the previous
    version to the new version <code>1.14.0-beta</code>:
    <ul>
      <li><a href="http://code.google.com/p/google-api-java-client/admin">admin</a></li>
      <li><a
        href="http://code.google.com/p/google-api-java-client/w/edit/Setup">wiki/Setup</a></li>
      <li><a
        href="http://code.google.com/p/google-api-java-client/w/edit/SampleProgram">wiki/SampleProgram</a></li>
    </ul>
    </li>
  </ul>
  </li>
  <li><a
    href="http://www.blogger.com/post-create.g?blogID=4531100327392916335">New
  Post</a> on the <a href="http://google-api-java-client.blogspot.com/">announcement
  blog</a> about the new version, including links to <a
    href="http://code.google.com/p/google-api-java-client/issues/list?can=1&q=milestone=Version1.14.0%20status=Fixed&colspec=ID%20Type%20Priority%20Summary">new
  features and bugs fixed</a>.</li>
</ul>
</body>
</html>
